-
Notifications
You must be signed in to change notification settings - Fork 462
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve specified type in comparisons #390
Conversation
Yes, please do the |
d45166a
to
3526237
Compare
7c9f17c
to
49cb8aa
Compare
I rebased this branch and the issue I mentioned is now fixed. |
Linking the fixed issue: phpstan/phpstan#577 I'm gonna review this once the time allows, hopefull soon :) |
Yes, please do. Can you also take a look at #416 - does it make sense to you? |
Thank you! |
Note that this PR has a side-effect that might need to be addressed, consider this code:
The change in output is as follows:
While technically correct, this is not very pretty.
Perhaps this can be fixed by adjusting how
IntegerRangeType
is represented. Currently,int<0, max>
(return value ofcount()
) is internally represented bymin=0, max=PHP_INT_MAX
, which is technically a bounded interval. If it were to usemin=0, max=null
instead, then the intended meaning of an open interval can be represented more accurately and the new code in this PR could make use of that information. If this sounds good I'll have a go at it.